fix: ALTER STYLING writes design properties on pages and snippets (#631)#632
Conversation
…ndixlabs#631) ALTER STYLING failed with "unsupported container type: PAGE" because the visitor stores ContainerType uppercase while the executor compared lowercase; the same casing bug silently broke DESCRIBE STYLING. Beyond casing, ALTER STYLING used the legacy reflection walker (walkPageWidgets + UpdatePage), which could not locate widgets in MDL-builder-created pages and bypassed the required mutator pattern. - Normalise container type case in execAlterStyling/execDescribeStyling. - Route ALTER STYLING through OpenPageForMutation (mutator pattern), matching ALTER PAGE; report a clean not-found error via FindWidget. - Add SetDesignProperty/RemoveDesignProperty/ClearDesignProperties to the PageMutator interface; the MPR implementation writes the widget's Appearance.DesignProperties BSON array (Toggle/Option/Custom value), preserving an existing custom kind on option updates. - Remove the dead reflection walker (widget_property.go). - Tests: mutator-level BSON tests + executor dispatch/casing tests. - Re-enable the ALTER STYLING examples and add a bug-test repro. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove - The PR is well-scoped, thoroughly tested, and correctly implements the fix while following all architectural guidelines. No changes are needed before merging. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
…dixlabs#631) Flip the Styling row to reflect the fix: DESCRIBE and ALTER now Y (the casing bug that broke DESCRIBE STYLING is fixed, and ALTER STYLING sets/ removes/clears design properties via the mutator), and Examples/Tests now Y. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove the PR. The fix is well-targeted, follows established patterns (mutator pattern, backend abstraction), includes comprehensive tests at multiple layers, removes dead code, and resolves both the explicit failure case and the silent DESCRIBE STYLING bug. The minor concerns about test cleanup and version gating are outweighed by the correctness of the fix and the fact that this resolves a blocking issue (#631). The PR demonstrates good understanding of the codebase architecture and makes minimal, focused changes to resolve the issue while improving overall consistency (removing legacy reflection walker in favor of the mutator pattern used elsewhere). Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
…dixlabs#631) Two correctness fixes for the design-property write path, found by dogfooding an Atlas 3 -> 4 migration: 1. Value-type encoding: ALTER STYLING hardcoded "option" for every `= 'value'` assignment, so ToggleButtonGroup/ColorPicker properties (Flex container, Align items X/Y, Item/Column gap, Button Style, ...) were written as Forms$OptionDesignPropertyValue instead of Forms$CustomDesignPropertyValue — Studio Pro would not recognise the value. The executor now resolves the BSON value-type from the theme registry (reusing the same Toggle/Option/Custom classification the CREATE PAGE builder uses) and the mutator honours an explicit "custom" type. 2. 'Style'/'Class' key collision: a quoted design-property key 'Style' (e.g. Button Style = 'Icon button') was routed to the CSS Style widget property because it shared StylingAssignment.Property with the STYLE keyword. Added an IsCSS flag set only for the CLASS/STYLE keywords; quoted keys are now always treated as design properties. Tests: resolveStylingValueType classification, quoted-'Style' dispatch, and mutator Custom-value encoding. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks GoodBug Fix Implementation
Code Quality
Documentation & Process
Architecture Compliance
RecommendationApprove. This PR correctly fixes a significant bug in ALTER STYLING by addressing both the surface-level casing issue and the deeper architectural problem of bypassing the mutator pattern. The implementation follows established patterns in the codebase (like ALTER PAGE), includes comprehensive test coverage at multiple levels, removes dead code, and maintains all architectural invariants. The fix is minimal, focused, and thoroughly verified. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
…ustom (mendixlabs#631) Correction to the prior value-type change. ToggleButtonGroup (and Dropdown) single-selection design properties are stored as Forms$OptionDesignPropertyValue, NOT Forms$CustomDesignPropertyValue. Verified against Studio Pro-authored widgets: e.g. `Flex container` appears 123x as Option vs 0x as Custom in a real Atlas 4 project; encoding them as Custom triggers consistency error CE6084 ("Expected design property X to be of type Toggle button group, but found Custom"). - ALTER STYLING now writes single-value design properties as "option" (the original, correct behaviour); the theme-registry "custom" resolution is removed. - Mutator: drop the "preserve existing custom kind" heuristic so re-applying an option value repairs a stale Custom entry; buildDesignPropertyValueDoc honours the requested value-type strictly. - The quoted-'Style' design-property fix (IsCSS) is retained — Button Style='Icon button' now writes as Option, which matches Studio Pro. NOTE: the SDK's serializeDesignProperties / page-builder resolveDesignProperty- ValueType still classify ToggleButtonGroup as "custom"; that is a separate pre-existing bug (affects CREATE PAGE) tracked independently. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove. The PR fully resolves issue #631 with minimal, focused changes that adhere to the project's architectural patterns (mutator pattern, backend abstraction). Test coverage is adequate, and no checklist violations are present. Minor test enhancements are optional but not blocking. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
The interface and mutator doc comments claimed an option-type set "preserves" an existing custom value's kind. The implementation does the opposite — it fully rewrites the entry's Value, overwriting a stale Custom value with an OptionDesignPropertyValue, which is what repairs the CE6084 a Custom encoding triggers (and what TestSetDesignProperty_ OptionOverwritesCustom asserts). Comment-only change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove. The PR fixes the reported issue comprehensively, follows established patterns (mutator pattern, backend abstraction), includes adequate tests, and maintains code quality. Minor issues are trivial and do not block merging. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
ALTER STYLING failed with "unsupported container type: PAGE" because the visitor stores ContainerType uppercase while the executor compared lowercase; the same casing bug silently broke DESCRIBE STYLING. Beyond casing, ALTER STYLING used the legacy reflection walker (walkPageWidgets + UpdatePage), which could not locate widgets in MDL-builder-created pages and bypassed the required mutator pattern.